package com.attendance.mapper;

import com.attendance.Utils.SQLProvider;
import com.attendance.model.Apply;
import com.attendance.model.Biz.BizApply;
import com.attendance.model.Form.ApplyForm;
import com.baomidou.mybatisplus.mapper.AutoMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

/**
 *
 * Apply 表数据库控制层接口
 *
 */
public interface ApplyMapper extends AutoMapper<Apply> {

    @Select("select * from apply a where a.uid = #{uid} and a.state=#{state}")
    public List<Apply> getApprovedApplyById(@Param("uid")Integer uid, @Param("state")Integer state);

    @Select("select * from apply a where a.uid = #{uid} and a.type=#{type} and a.state=#{state}")
    public List<Apply> getApprovedApplyByIdAndType(@Param("uid")Integer uid, @Param("type")Integer type, @Param("state")Integer state);
    @SelectProvider(type = SQLProvider.class, method = "queryBizApply")
    List<BizApply> getAll(ApplyForm applyForm);
}